package com.qing.utils

import org.apache.hadoop.hbase.{HBaseConfiguration, HColumnDescriptor, HTableDescriptor}
import org.apache.hadoop.hbase.client.{HBaseAdmin, HTable}

/**
  * Created by wuliao on 2018/1/8.
  */
object HBaseUtils {


  val conf = HBaseConfiguration.create()
  conf.set("hbase.master", "impala01:60000")
  conf.set("hbase.zookeeper.quorum", "impala02,impala03,impala04")

  val admin = new HBaseAdmin(conf);
  if (!admin.tableExists("user")) {
    val tableDescriptor = new HTableDescriptor("user");// Table Name
    tableDescriptor.addFamily(new HColumnDescriptor("info"));// Family Name必须和后面插入数据的Family对应
    admin.createTable(tableDescriptor)
  }
  val userTable = new HTable(conf, "user")





}
